123456/V5 PT 2324/x111/H2.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<style>
table, th, td{
border: 1px solid black;
border: collapse: collapse;
}
</style>
<?php
include ('db.php');
$query = "SELECT voornaam, tussenvoegsel, achternaam FROM leerlingen ORDER BY achternaam";
$result = mysqli_query($db, $query) or die (mysqli_error($db));
echo "<table border=1>";
echo "<tr>";
echo "<th>Voornaam</th><th>Tussenvoegsel</th><th>Achternaam</th></th>";
echo "</tr>\n";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>$row[0]</td>\n<td>$row[1]</td>\n<td>$row[2]</td>\n";
echo "</tr>\n";
}
echo "</table>";
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse